package com.isoft.farm.controller;

import com.isoft.farm.common.JsonResult;
import com.isoft.farm.entity.SysRole;
import com.isoft.farm.service.SysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/role")
public class SysRoleController {
    @Autowired
    SysRoleService sysRoleService;

    @RequestMapping("/doFindRoles")
    public JsonResult doFindRoles(){
        return new JsonResult(sysRoleService.findObjects());
    }

    @RequestMapping("/doFindPageObjects")
    public JsonResult doFindPageObjects(String name,Integer pageCurrent) {
        return new JsonResult(sysRoleService.findPageObjects(name, pageCurrent));
    }
    @RequestMapping("/doSaveObject")
    public JsonResult doSaveObject(SysRole sysRole, Integer[] menuIds){
        sysRoleService.saveObject(sysRole,menuIds);
        return new JsonResult();
    }

//    @RequestMapping("/doDeleteObject")
//    public JsonResult doDeleteObject(Integer id){
//        sysRoleService.deleteObject(id);
//        return new JsonResult();
//    }
//
//    @RequestMapping("/doFindObjectById")
//    public JsonResult doFindObjectById(Integer id){
//        return new JsonResult(sysRoleService.findObjectById(id));
//    }
//
//    @RequestMapping("/doUpdateObject")
//    public JsonResult doUpdateObject(SysRole sysRole, Integer[] menuIds){
//        sysRoleService.updateObjectById(sysRole,menuIds);
//        return new JsonResult();
//    }
}
